package com.cofey.app;

import com.cofey.remote.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;

/**
 * Created by cofey on 16/6/3.
 */
@SpringCloudApplication
@EnableFeignClients(basePackages = {"com.cofey.remote"})
public class Application1 implements CommandLineRunner {
    public static void main(String[] args) {
        new SpringApplicationBuilder(Application1.class).web(true).run(args);
    }

    @Value("${test.env}")
    private String env;
    @Autowired
    private DemoService demoService;

    @Override
    public void run(String... args) throws Exception {
        System.out.println("env:" + env);
        UserReqVo userReqVo = new UserReqVo();
        userReqVo.setUserName("cofey");
        ReqVo<UserReqVo> reqVo = new ReqVo<>();
        reqVo.setEntCode("E0001");
        reqVo.setReqBody(userReqVo);
        ResVo<UserResVo> resVo = demoService.findUser(reqVo);
        System.out.println("resVo:" + resVo);
    }
}
